
$(function() {

    $('#forgetPasswordForm').validate({
        rules:{
            email: {
                required: true
            }
        },
        messages: {
            email: {
                required: "邮箱不能为空！"
            }
        },

        submitHandler: function(form){
            waitMessage();
            $.ajax({
                    type: "post",
                    url: path+"/forgetPassword",
                    data: {
                        email: $('#email').val()
                    },
                    dataType: 'json',
                    success: function(data, textStatus){
                        if(data.success){
                            successMessage("邮件发送成功，请到邮箱查收!");
                        }
                        else errorMessage("邮件发送失败，请重试!");
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown){
                        errorMessage("操作失败，错误代码： " + XMLHttpRequest.status);
                    }
                }
            );
        }
    });
});